/**
 * 
 */
package com.demo2do.strawberry.entity.startup;

/**
 * @author Downpour
 */
public enum Type {

	ONLINE("enum.startup-type.online"),
	
	OFFLINE("enum.startup-type.offline");
	
	private String key;
	
	/**
	 * default constructor
	 */
	private Type() {
		
	}
	
	/**
	 * 
	 * @param key
	 */
	private Type(String key) {
		this.key = key;
	}
	
	
	/**
	 * @return the key
	 */
	public String getKey() {
		return this.key;
	}
	
	/**
	 * @return the alias
	 */
	public String getAlias() {
		return this.key.substring(this.key.lastIndexOf(".") + 1);
	}
	
	/**
	 * @param value
	 * @return
	 */
	public static Type aliasOf(String value) {
		for(Type type : Type.values()) {
			if(type.getAlias().equalsIgnoreCase(value)) {
				return type;
			}
		}
		return null;
	}
}
